<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
    ul{
        list-style: none;
        display: flex;
        }
        li{
            padding: 20px;
            background-color: antiquewhite;
            margin-left: 10px;
        }
        .red{
            background-color: red;
            color: aliceblue;
        }
    </style>
</head>
<body>
    <div id="app">
        <ul>
            <li 
            v-for="(v,i) in movies" 
            :key="i" 
            :class="{red:index==i}"
            @click="index=i">{{v}}</li>
        </ul>
    </div>
    <script>
        new Vue({
            el:"#app",
            data(){
            return{
                movies:["1","2","3"],
                index:0
            }
            },
        })
    </script>
</body>
</html>